package com.tianhui.consignortwofei.mvp.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tianhui.consignortwofei.R;
import com.tianhui.consignortwofei.mvp.model.enty.statistics.StatisticsItemInfo;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

/**
 * @author fgs
 * @date 2021/2/23
 * @description
 **/
public class StatisticsItemAdapter extends RecyclerArrayAdapter<StatisticsItemInfo> {
    public StatisticsItemAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new StatisticsItemViewHolder(parent, R.layout.item_statistics_info_item);
    }

    public class StatisticsItemViewHolder extends BaseViewHolder<StatisticsItemInfo> {

        private TextView titleTextView;
        private TextView contentTextView;

        public StatisticsItemViewHolder(ViewGroup parent, int res) {
            super(parent, res);
            titleTextView = getView(R.id.item_statistics_info_item_titleTextView);
            contentTextView = getView(R.id.item_statistics_info_item_contentTextView);
        }

        @Override
        public void setData(StatisticsItemInfo data) {
            super.setData(data);
            titleTextView.setText(data.title);
            contentTextView.setText(data.content);
        }
    }
}
